package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Mobile   string `gorm:"type:char(11);not null;comment:手机号"`
	Password string `gorm:"type:char(32);not null;comment:密码"`
	Status   int64  `gorm:"type:tinyint(1);default:1;comment:用户状态:1:正常,2:冻结"`
}
type RealName struct {
	gorm.Model
	UserId   int64  `gorm:"type:int(11);not null;comment:用户id"`
	RealName string `gorm:"type:char(3);not null;comment:用户名"`
	IdCord   string `gorm:"type:char(18);not null;comment:身份证号"`
}

func (u *User) Create() error {
	return Db.Create(&u).Error
}
func (u *User) UserInfo(mobile string) error {
	return Db.Where("mobile = ?", mobile).Limit(1).Find(&u).Error
}
